package cn.gjculture.shopping.api.controller;

import cn.gjculture.shopping.api.entity.Return;
import cn.gjculture.shopping.api.entity.Token;
import cn.gjculture.shopping.api.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/loginMgr")
public class LoginManagerController {

    @Autowired
    LoginService loginService;

    @PostMapping
    public Return login(String username,String password){
        Return<Token> ret=new Return<>();
        if(loginService.loginMgr(username,password,ret)){
            ret.getCommon().setRet(true);
        }
        return ret;
    }


}
